from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from scipy.integrate import odeint
import scipy

def lorenz_int(initial, t, settings=[10,28,8.0/3]):
    x = initial[0]
    y = initial[1]
    z = initial[2]
    #
    sigma = settings[0]
    rho = settings[1]
    beta = settings[2]
    x_dot = sigma * (y - x)
    y_dot = x * (rho -z) - y
    z_dot = x * y - beta* z
    return [x_dot, y_dot, z_dot]


if __name__ == '__main__':
    
    fig = plt.figure()
    ax = Axes3D(fig)
        
    initial = [0, 1, 1.05]
    
    t = scipy.arange(0, 100, 0.01)
    lorenz_sol = odeint(lorenz_int, initial, t)
    
    x = [i[0] for i in lorenz_sol]
    y = [i[1] for i in lorenz_sol]
    z = [i[2] for i in lorenz_sol]
    
    # ax.xlabel('x')
    ax.set_xlabel('X axis')
    ax.set_ylabel('Y axis')
    ax.set_zlabel('Z axis')
    
    ax.plot(x, y, z, label="lorenz" )
    ax.legend()
    plt.show()
    
    